<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.yaodian100.core.common.utils.ServerValue" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ include file="/taglibs.jsp" %>

<c-rt:set var="midContextPath" value="<%=ServerValue.getMidContextPath()%>" />

<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="${midContextPath}/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="${midContextPath}/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="${midContextPath}/css/smoothness.datepick.css" />

<script language="javascript">
	$().ready(function(){
		$('#applyDateParam').datepick({minDate: null, showOn: 'both',numberOfMonths:2,
	    	buttonImageOnly: true, buttonImage: '${midContextPath}/images/calendar.gif',dateFormat:"yy-mm-dd",yearRange: '-50:+50'});
	});
</script>

<s:if test="hasActionErrors()">
	<s:actionerror cssClass="msg rn"/><p />
</s:if>
<s:if test="hasActionMessages()">
	<s:actionmessage cssClass="msg rn"/><p />
</s:if>
<s:if test="hasFieldErrors()">
	<s:fielderror cssClass="msg rn"/><p />
</s:if>

<s:form action="list.do" method="post" id="formObj">
	<s:hidden name="currentPage" />
	<h1>礼品卡管理 - 查询</h1>
	<div class="f-link">
		<a href="add.do">新增礼品卡申请</a>
	</div>
	
	<div class="data-form">
		<b>礼品卡名称：</b><input type="text" name="giftcardNameParam" value="${giftcardNameParam}" />
		<b>申请日期：</b><input type="text" name="applyDateParam" id="applyDateParam" size="10" value="${applyDateParam}" readonly="readonly" />
		<b>状态：</b><s:select name="giftcardQueryStatusParam" list="giftcardQueryStatusMenu.options" listKey="key" listValue="value.name" />
		<input type="submit" value="查询" />
		<input type="reset" value="复位" />
	</div>
</s:form>

<br />
<br />
<br />
<s:if test="giftcardAmounts.size > 0">
	<yaodian100:pageutil pagerObj="${pager}" link="list.do"/>
	<table width="100%">
		<thead class="tb-1">
			<tr>
				<th>礼品卡批号</th>
				<th>礼品卡名称</th>
				<th>申请日期</th>
				<th>申请人</th>
				<th>状态</th>
				<th>面额</th>
				<th>数量</th>
				<th>已领数量</th>
			</tr>
		</thead>
		<tbody class="tb-1">
			<c:forEach items="${giftcardAmounts}" var="giftcardAmount" varStatus="rows_index">
				<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
					<td><a href="${midContextPath}/giftcard/viewAmount.do?mainId=${giftcardAmount.mainId}">${giftcardAmount.mainId}</a></td>
					<td>${(giftcardMainMap[giftcardAmount.mainId]).giftcardName}</td>
					<td><fmt:formatDate value="${(giftcardMainMap[giftcardAmount.mainId]).applyDate}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td>${(giftcardMainMap[giftcardAmount.mainId]).applyUser}</td>
					<td>${giftcardQueryStatusMenu.options[giftcardAmount.status].name}</td>
					<td>${giftcardAmount.amount}</td>
					<td>${giftcardAmount.count}</td>
					<td>${giftcardAmount.receiveCount}</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<yaodian100:pageutil pagerObj="${pager}" link="list.do"/>
</s:if>